// Copyright (c) 2019 Graphcore Ltd. All rights reserved.
#ifndef POPFLOAT_CYCLE_COUNT_H
#define POPFLOAT_CYCLE_COUNT_H
#include "asm/GfloatConst.hpp"

#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_GFLOAT16_OUTPUT 5
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_GFLOAT8_OUTPUT 4
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_SET_SAVE_AS_GFLOAT8 8
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_PROLOG 15
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_SET_ROUND_MODE 17
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_CAST_LOOP 1
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_HALF_LOAD_CLIP_SCALE 5
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_HALF_SCALE_INPUT 7
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_FLOAT_LOAD_CLIP_SCALE 8
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_FLOAT_SCALE_INPUT 6
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_FLOAT_IN_TO_HALF 7
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_LOAD_CLIP_SCALE_END 4
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_CALC_DENORM_MANT_MASK 8
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_ADD_CORRECTION 7
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_GEN_NAN_ON_OVERFLOW 5
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_SAVE_FP16 6
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_SAVE_FP8_1_5_2 9
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_SAVE_FP8_MIN_NORM_ALIGN 14
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_SAVE_FP8_MAX_NORM_ALIGN 14
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_ROUND_ZERO 1
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_ROUND_NEAREST_EVEN 12
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_ROUND_NEAREST_AWAY 6
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_ROUND_POS_INF 3
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_ROUND_NEG_INF 3
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_STOCHASTIC_ROUND_FULL 3
#define POPFLOAT_CAST_TO_GF16_CYCLE_COUNT_STOCHASTIC_ROUND_SHORT 8

#define POPFLOAT_CAST_GF8_TO_FP16_CYCLE_COUNT_PROLOG 14
#define POPFLOAT_CAST_GF8_TO_FP16_CYCLE_COUNT_NORM_ALIGN_PROLOG 8
#define POPFLOAT_CAST_GF8_TO_FP16_CYCLE_COUNT_FP8_1_5_2_TO_FP16 5
#define POPFLOAT_CAST_GF8_TO_FP16_CYCLE_COUNT_FP8_MIN_NORM_ALIGN 15
#define POPFLOAT_CAST_GF8_TO_FP16_CYCLE_COUNT_FP8_MAX_NORM_ALIGN 9

#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_PROLOG 35
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_SET_SAVE_AS_GFLOAT16 11
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_SET_ROUND_MODE 17
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_ITER_START 7
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_CALC_DENORM_MASK 7
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_ADD_CORRECTION 10
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_GEN_NAN_ON_OVERFLOAT 4
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_SAVE_FP32 3
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_SAVE_FP16 5
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_SAVE_BF16 5
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_SAVE_GF16_NO_DENORM 13
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_SAVE_GF16_EN_DENORM 19
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_ROUND_ZERO 3
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_ROUND_NEAREST_EVEN 14
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_ROUND_NEAREST_AWAY 4
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_ROUND_POS_INF 5
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_ROUND_NEG_INF 5
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_STOCHASTIC_ROUND_FULL 9
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_STOCHASTIC_ROUND_SHORT 5
#define POPFLOAT_CAST_TO_GF32_CYCLE_COUNT_HALF_MIN_SR 6

#define POPFLOAT_CAST_GF16_TO_FP32_CYCLE_COUNT_PROLOG 25
#define POPFLOAT_CAST_GF16_TO_FP32_CYCLE_COUNT_EN_DENORM_PROLOG 9
#define POPFLOAT_CAST_GF16_TO_FP32_CYCLE_COUNT_BF16_TO_FP32 3
#define POPFLOAT_CAST_GF16_TO_FP32_CYCLE_COUNT_GF16_NO_DENORM 15
#define POPFLOAT_CAST_GF16_TO_FP32_CYCLE_COUNT_GF16_EN_DENORM 16

#define POPFLOAT_CAST_GFLOAT16_PARAM_CALC_CYCLE_COUNT_PARAM 85
#define POPFLOAT_CAST_GFLOAT16_PARAM_CALC_CYCLE_COUNT_SET_SAVE 7
#define POPFLOAT_CAST_GFLOAT16_PARAM_CALC_CYCLE_COUNT_HALF_PARAMS 9
#define POPFLOAT_CAST_GFLOAT16_PARAM_CALC_CYCLE_COUNT_FLOAT_PARAMS 9
#define POPFLOAT_CAST_GFLOAT16_PARAM_CALC_CYCLE_COUNT_SR_MASK 8

#define POPFLOAT_CAST_GF8_TO_FP16_PARAM_CALC_CYCLE_COUNT 34

#define POPFLOAT_CAST_GFLOAT32_PARAM_CALC_CYCLE_COUNT_PARAM 50
#define POPFLOAT_CAST_GFLOAT32_PARAM_CALC_CYCLE_COUNT_SET_SAVE 15
#define POPFLOAT_CAST_GFLOAT32_PARAM_CALC_CYCLE_COUNT_SR_MASK 7

#define POPFLOAT_CAST_GF16_TO_FP32_PARAM_CALC_CYCLE_COUNT 44

#endif
